package day2.assignments;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class BillPayment2
 */
@WebServlet(urlPatterns = { "/BillPayment2" }, name = "BillPayment2")
public class BillPayment2 extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private ServletContext ctx;

	/*
	 * public void init(ServletConfig cfg) throws ServletException {
	 * super.init(cfg); this.ctx = getServletContext(); }
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		request.setAttribute("BillAmount", request.getParameter("amt"));
		request.setAttribute("PaymentMode", request.getParameter("mode"));
		ctx = getServletContext();
		RequestDispatcher rd = ctx.getRequestDispatcher("/MakePayment");
		rd.forward(request, response);
	}
}